<!-- 订单详情弹窗 -->
<template>
            <a-form
                    ref="form3"
                    class="ele-form-detail"
                    :model="orderModalApp.order"
                    :label-col="{md: {span: 2}, sm: {span: 4}, xs: {span: 6}}"
                    :wrapper-col="{md: {span: 22}, sm: {span: 20}, xs: {span: 18}}">
                <a-descriptions :title="orderModalApp.title" bordered>
                                    <a-descriptions-item label="标识">
                        {{ orderModalApp.order.Eid }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="创建人">
                        {{ orderModalApp.order.creatorName }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="名称">
                        {{ orderModalApp.order.name }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="订单号">
                        {{ orderModalApp.order.code }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="商品">
                        {{ orderModalApp.order.commodityId }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="规格">
                        {{ orderModalApp.order.specification }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="购买用户">
                        {{ orderModalApp.order.userId }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="用户地址">
                        {{ orderModalApp.order.userAdressId }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="店铺">
                        {{ orderModalApp.order.shopId }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="订单状态">
                        {{ orderModalApp.order.orderStatus }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="付款时间">
                        {{ orderModalApp.order.payTime }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="发货时间">
                        {{ orderModalApp.order.deliveryTime }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="签收时间">
                        {{ orderModalApp.order.signTime }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="完成时间">
                        {{ orderModalApp.order.completeTime }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="状态">
                        {{ orderModalApp.order.status }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="创建人ID">
                        {{ orderModalApp.order.creatorId }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="备注">
                        {{ orderModalApp.order.remark }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="创建时间">
                        {{ orderModalApp.order.createDatetime }}
                    </a-descriptions-item>
                                </a-descriptions>
            </a-form>
</template>

<script>
    import {defineComponent, reactive, onMounted, inject} from "vue";
    import {useRoute} from "vue-router"
    import {OrderService} from "@/views/mall/Order/order/orderService";

    export default defineComponent({
        setup() {
            const route = useRoute();
            let routeId = route.params.id;
            let orderListApp = inject('orderListApp', reactive({}));
            const orderModalApp = reactive({id: null, order: {}, display: false});

            onMounted(() => {
                    orderModalApp.order = {};
                if (routeId) {
                        orderModalApp.id = routeId;
                } else if (orderListApp.viewModalShowing) {
                        orderModalApp.id = orderListApp.currentId;
                        orderModalApp.display = true;
                }
                if (orderModalApp.id) {
                    getInfo(orderModalApp.id);
                }
            })

            const getInfo = (id) => {
                    OrderService.findOrder(id).then((res) => {
                            orderModalApp.order = res.data;
                            orderModalApp.title = "查看 " + orderModalApp.order.name;
                })
            }

            return {
                    orderModalApp,
                routeId,
                getInfo,
            }
        }
    })
</script>

<style scoped>
</style>

